<?php

/*
 * Action 4$
 *
 * Gain a card costing up to 4 Coin, putting it on top of your deck.
 */

class Armory extends Card implements iAction, iKingdom, iDarkAges {

    public function __construct() {
        parent::__construct("Armory", 4);
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "Gain a card costing up to 4 Coin, putting it on top of your deck.");
    }

    public function play(Game $game, $isRealCard) {

        $new_price = new Price(4);
        $optional_cards = $game->getBoardCardsByPrice(new Price(), $new_price);
        if (sizeof($optional_cards) > 0) {
            $output = MySocket::GetUserReply($game, Input_ChooseOne, $optional_cards, 1, 1, null, "Choose a card costing up to 4$ to gain");

            $new_card_name = $output[0];
            $new_card = $game->moveCardFromPileToPile($new_card_name, BoardCards, DrawPile);
            ScreenDisplay::addScreenMessage($game, false, " and gain " . nicePrint($new_card), " and gains " . ScreenDisplay::$LMSG);
        }

        $game->cardActionFinished();
        return true;
    }

}

?>